home *** CD-ROM | disk | FTP | other *** search
- /*
- * Macintosh Window abstract class
- *
- * OIC-based access to the Mac Toolbox window manager.
- *
- * Copyright © John Wainwright 1988
- *
- * MetaClass :
- *
- * SuperClasses :
- *
- * Instance Vars :
- *
- * Class Vars : I'm lazy!
- *
- * Methods :
- *
- * Class Methods :
- *
- */
-
- #include "oic.h"
- #include "generics.h"
-
- class Window; /* the Window class */
-
- struct window_i /* Window instance structure */
- {
- WindowPtr window; /* the Mac window structure */
- };
- typedef struct window_i window_i;
-
- enum { TITLE = 1, BOUNDS, KIND }; /* "new" keyword args */
-
- /* -------------------- Window Instance methods --------------------------- */
-
- static object
- _new(self, w, wa)
- object self;
- register window_i *w;
- register keyword_args wa;
- {
- w->window = NewWindow(NULL, key_arg(wa, BOUNDS, NULL),
- key_arg(wa, TITLE, "Untitled"),
- -1,
- (int)key_arg(wa, KIND, 1L),
- -1L, 1, self);
-
- return Super(self, END);
- }
-
- static
- _draw(self, w)
- object self;
- window_i *w;
- {
- object contents, item;
-
- SetPort(w->window);
- EraseRect(&w->window->portRect);
- for (contents = sequence(self); item = next(contents); )
- draw(item);
- }
-
- static object
- _repList(self)
- object self;
- {
- register replist replist;
-
- replist = New(Replist, "{", "}", ":");
- add(replist, className(self), Super(self), END);
- return replist;
- }
-
- /* ------------------- Init the Window class ------------------------------- */
-
- InitWindowClass()
- {
- Window = NewClass(sizeof(window_i), 0, "Window", List, END);
- AddMethods(Window,
- newGeneric, _new,
- drawGeneric, _draw,
- repListGeneric, _repList,
- END);
- }
-
-